#include <iostream>
#include <thread>
#include <future>

int Add(int num1, int num2)
{
    std::cout << "加法 111" << std::endl;
    std::this_thread::sleep_for(std::chrono::seconds(5));
    std::cout << "加法 222" << std::endl;
    return num1 + num2;
}

int main()
{
    std::cout << "111" << std::endl;
    std::future<int> result = std::async(std::launch::async, Add, 2, 3);
    std::this_thread::sleep_for(std::chrono::seconds(1));
    std::cout << "222" << std::endl;
    int sum = result.get();
    std::cout << "333" << std::endl;
    std::cout << sum << std::endl;
    return 0;
}